﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using iOak.Data.Campaigns;
using iOak.Domain.Campaigns;
using iOak.Common.Untity;

namespace iOak.Business.Campaigns
{
    public class ApplicationService
    {
        private ApplicationRepository _applicationRepository;
        public ApplicationService()
        {
            _applicationRepository = new ApplicationRepository("master");
        }

        public void Create(ApplicationBase application)
        {
            _applicationRepository.Create(application);
        }

        public ApplicationBase Retrieve(Guid applicationId)
        {
            return _applicationRepository.Retrieve(applicationId);
        }

        public void Update(ApplicationBase application)
        {
            _applicationRepository.Update(application);
        }

        public void Delete(Guid applicationId)
        {
            _applicationRepository.Delete(applicationId);
        }

        public int GetCountByCampaignId(Guid campaignId, ApplicationStatus? applicationStatus = null)
        {
            return _applicationRepository.GetCountByCampaignId(campaignId, applicationStatus);
        }

        public ApplicationBase GetListByCampaignIdAndCompanyId(Guid campaignId, Guid companyId)
        {
            return _applicationRepository.GetListByCampaignIdAndCompanyId(campaignId, companyId);
        }

        public List<ApplicationBase> GetListUsedByDefaultPage()
        {
            return _applicationRepository.GetListUsedByDefaultPage();
        }

        public List<ApplicationBase> GetListByCampaignId(Guid campaignId, bool blPass = false)
        {
            return _applicationRepository.GetListByCampaignId(campaignId, blPass);
        }

        public List<ApplicationBase> GetListByCompanyId(Guid companyId)
        {
            return _applicationRepository.GetListByCompanyId(companyId);
        }

        public List<ApplicationBase> LoadAll()
        {
            return _applicationRepository.LoadAll();
        }

        public List<ApplicationBase> GetListByCheckedBy(Guid userId, Guid? campaignId = null)
        {
            return _applicationRepository.GetListByCheckedBy(userId, campaignId);
        }

        public List<ExportCVSModule> GetListByCSV(Guid campaignId)
        {
            return _applicationRepository.GetListByCSV(campaignId);
        }
    }
}
